package com.sky.mapper;

import com.sky.annotation.AotuFillInsert;
import com.sky.annotation.AotuFillUpdate;
import com.sky.dto.EmployeeDTO;
import com.sky.dto.EmployeePageQueryDTO;
import com.sky.entity.Employee;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface EmployeeMapper {

    /**
     * 根据用户名查询员工
     * @param username
     * @return
     */
    @Select("select * from employee where username = #{username}")
    Employee getByUsername(String username);

    @Select("select count(*) from sky_take_out.employee where  username = #{username}")
    Integer selectCountByusername(EmployeeDTO employeeDTO);

    /**
     * 添加员工
     * @param employee
     */
    @AotuFillInsert
    void insert(Employee employee);

    /**
     * 分页查询
     * @param employeePageQueryDTO
     * @return
     */
    List<Employee> page(EmployeePageQueryDTO employeePageQueryDTO);
    @AotuFillUpdate
    void modifyStatus(Long id, Integer status);

    @AotuFillUpdate
    void updateById(Employee employee);

    Employee getById(Long id);

    Integer selectCountByusernameAndNotId(String username, Long id);
}
